package com.origin.oss.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.origin.oss.entity.ImageInfo;
import com.origin.oss.mapper.ImageInfoMapper;
import com.origin.oss.service.ImageInfoService;
import org.springframework.stereotype.Service;

/**
 * @author yezh
 * @date 2024/2/5 16:05
 */
@Service
public class ImageInfoServiceImpl implements ImageInfoService {

    private final ImageInfoMapper imageInfoMapper;

    public ImageInfoServiceImpl(ImageInfoMapper imageInfoMapper) {
        this.imageInfoMapper = imageInfoMapper;
    }

    @Override
    public void insert(ImageInfo imageInfo) {
        imageInfoMapper.insert(imageInfo);
    }

    @Override
    public ImageInfo getByFileId(String fileId) {
        return imageInfoMapper.selectOne(new LambdaQueryWrapper<ImageInfo>().eq(ImageInfo::getFileId, fileId));
    }
}
